package com.sangmo.fts.user.model;

import com.sangmo.boot.framework.data.entity.general.LongEntity;
import com.sangmo.fts.common.IConstants;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.beans.Transient;

@Entity
@Table(name = "role")
public class Role extends LongEntity {

    private String exRoleId;
//    @DataField(value = "name", required = true, index = true, unique = true)
    private String name;
//    @DataField(value = "code", required = true, index = true, unique = true)
    private String code;
//    @DataField(value = "description")
    private String description;
//    @DataField(value = "state", required = true, index = true)
    private String state = States.ENABLED;

    private int sort;

    public String getExRoleId() {
        return exRoleId;
    }

    public void setExRoleId(String exRoleId) {
        this.exRoleId = exRoleId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    @Transient
    public boolean isEnabled() {
        return User.States.ENABLED.equals(state);
    }

    public interface States extends IConstants.ENABLE_STATE {
    }
}
